package com.zhehekeji.opsys.api.webservice.server;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;

import com.zhehekeji.opsys.api.req.LuckyAnswerReq;
import com.zhehekeji.opsys.api.resp.GetSurveyListResp;
import com.zhehekeji.opsys.api.resp.GetSurveyQuestionListResp;
import com.zhehekeji.opsys.api.resp.GetSurveyQuestionResp;
import com.zhehekeji.opsys.api.resp.GetSurveyResp;
import com.zhehekeji.opsys.api.resp.LuckyAnswerResp;

/**
 * @ClassName SurveyManager
 * @Description TODO
 * @author chenweiliu chenwei.liu@163.com
 * @date 2016-11-11   上午11:27:30
 */
@Path(value="/")
@WebService
@CrossOriginResourceSharing(allowAllOrigins=true)
public interface SurveyManager {
	
	@GET
	@Path(value="getSurvey")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetSurvey",operationName="getSurvey")
	GetSurveyResp getSurvey(@WebParam(name="surveyCode")@QueryParam(value="surveyCode")String surveyCode);
	
	@GET
	@Path(value="getSurveyList")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetSurveyList",operationName="getSurveyList")
	GetSurveyListResp getSurveyList(@WebParam(name="cpCode")@QueryParam(value="cpCode")long cpCode,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	@GET
	@Path(value="getSurveyQuestionList")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetSurveyQuestionList",operationName="getSurveyQuestionList")
	GetSurveyQuestionListResp getSurveyQuestionList(@WebParam(name="surveyCode")@QueryParam(value="surveyCode")String surveyCode,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	
	@POST
	@Path(value="luckyAnswer")
	@Consumes(value=MediaType.APPLICATION_JSON )
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doLuckyAnswer",operationName="luckyAnswer")
    LuckyAnswerResp luckyAnswer(LuckyAnswerReq luckyAnswerReq);
	
	@GET
	@Path(value="getCurrentSurveyQuestion")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetCurrentSurveyQuestion",operationName="getCurrentSurveyQuestion")
    GetSurveyQuestionResp getCurrentSurveyQuestion(@WebParam(name="surveyCode")@QueryParam(value="surveyCode")String surveyCode,
                                                   @WebParam(name="userID")@QueryParam(value="userID")String userID);
	
}

